<!DOCTYPE html>
<html lang="zh-cmn-Hans">

<head>
    <meta charset="utf-8"/>
    <meta name="format-detection" content="telephone=no"/>
    <meta name="viewport"
          content="width=device-width, initial-scale=1.0, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0, viewport-fit=cover">
    <meta name="apple-mobile-web-app-capable" content="yes"/>
    <meta name="apple-mobile-web-app-status-bar-style" content="black"/>
    <title>个人中心</title>
    <link rel="stylesheet" href="/ui/mobile/iconfont/iconfont.css">
    <link rel="stylesheet" href="/ui/mobile/css/ui.all.css"/>
    <link rel="stylesheet" href="/ui/mobile/css/style.css" type="text/css"/>
</head>

<body class="my-wrapper">
<main class="c-main">
    <header class="my-header">
        <div data-cont="avatarUrl" class="my-avatar"></div>
        <div class="my-info">
            <p data-cont="userName" class="mi-name">陈新同</p>
            <p class="mi-tel">夏翎教育</p>
        </div>
    </header>

    <a href="/m/questionOrder/myOrder.html" class="my-order">
        <img src="/ui/mobile/images/icon-order.png" alt="">
        <p class="mo-tit">我的订单</p>
        <i class="iconfont icon-xiangyou"></i>
    </a>

    <footer class="footer"></footer>
</main>

<script type="text/javascript" src="/m/public/all.ui.js"></script>
<script src="/ui/mobile/iconfont/iconfont.js"></script>
<script src="/m/public/util.js"></script>

<script src="/m/public/getFooterWidget.js"></script>

<script type="text/javascript">
    $('footer').html(getFooterWidget("my"));

    getCurrUserInfo(({Code, Message: msg, Result: userInfo}) => {
        if (Code !== 10000) {
            return location.href = "/m/error.html?" + $.param({msg, back: window.location.href});
        }

        const {userName, avatarUrl} = userInfo;
        $("[data-cont=avatarUrl]").html(`<img src="${avatarUrl || `https://f1.yihuimg.com/concat/mobile/3.0/cross/images/p-common.png`}" alt="">`)
        $('[data-cont="userName"]').text(userName || "未命名");
    });

    function getCurrUserInfo(callback = Function()) {
        return $.sApi({
            url: "/Login/getCurrUserInfo"
        }, callback)
    }

</script>
</body>

</html>